from typing import Optional
from datetime import datetime
from decimal import Decimal
from pydantic import BaseModel, Field

class AirticketOrderPassengerBase(BaseModel):
    airticket_order_id: int
    PassengerName: str = Field(..., description="乘客姓名")
    PassengerType: str = Field(..., description="乘客类型")
    CertificateType: str = Field(..., description="乘客证件类型")
    CertificateNo: Optional[str] = Field(None, description="乘客证件号码")
    Birthday: datetime = Field(..., description="乘客生日")
    TicketPrice: Decimal = Field(..., description="票面价格")
    AirportTax: Decimal = Field(..., description="机场税")
    FuelTax: Decimal = Field(..., description="燃油税")

class AirticketOrderPassengerCreate(AirticketOrderPassengerBase):
    pass

class AirticketOrderPassengerUpdate(BaseModel):
    PassengerName: Optional[str] = None
    PassengerType: Optional[str] = None
    CertificateType: Optional[str] = None
    CertificateNo: Optional[str] = None
    Birthday: Optional[datetime] = None
    TicketPrice: Optional[Decimal] = None
    AirportTax: Optional[Decimal] = None
    FuelTax: Optional[Decimal] = None

class AirticketOrderPassenger(AirticketOrderPassengerBase):
    ID: int

    class Config:
        from_attributes = True 